package com.wangshouyu.mp.pay.order;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 关闭订单请求
 * @date 2020/8/13 14:27
 */
@XStreamAlias(value = "xml")
public class CloseOrderRequest implements Serializable {

    /**
     * 公众账号ID
     * 微信支付分配的公众账号ID（企业号corpid即为此appId）
     */
    @XStreamAlias(value = "appid")
    private String appId;

    /**
     * 商户号
     * 微信支付分配的商户号
     */
    @XStreamAlias(value = "mch_id")
    private String mchId;

    /**
     * 商户订单号
     */
    @XStreamAlias(value = "out_trade_no")
    private String outTradeNo;

    /**
     * 随机字符串
     * 随机字符串，不长于32位。
     */
    @XStreamAlias(value = "nonce_str")
    private String nonceStr;

    /**
     * 签名
     */
    @XStreamAlias(value = "sign")
    private String sign;

    /**
     * 签名类型
     * 签名类型，目前支持HMAC-SHA256和MD5，默认为MD5
     */
    @XStreamAlias(value = "sign_type")
    private String signType;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CloseOrderRequest that = (CloseOrderRequest) o;
        return Objects.equals(appId, that.appId) &&
                Objects.equals(mchId, that.mchId) &&
                Objects.equals(outTradeNo, that.outTradeNo) &&
                Objects.equals(nonceStr, that.nonceStr) &&
                Objects.equals(sign, that.sign) &&
                Objects.equals(signType, that.signType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(appId, mchId, outTradeNo, nonceStr, sign, signType);
    }

    @Override
    public String toString() {
        return "CloseOrderRequest{" +
                "appId='" + appId + '\'' +
                ", mchId='" + mchId + '\'' +
                ", outTradeNo='" + outTradeNo + '\'' +
                ", nonceStr='" + nonceStr + '\'' +
                ", sign='" + sign + '\'' +
                ", signType='" + signType + '\'' +
                '}';
    }
}
